<script>
    const arr = [
        { name: '张三', age: 18, address: '湖北' },
        { name: '李四', age: 18, address: '安徽' },
        { name: '王五', age: 18, address: '北京' }
    ]
    const map = { name: '姓名', age: '年龄', address: '地址' }

    function change(arr, map) {
        if(arr.length === 0){
            return []
        }

        // 得到所有英文的keys 
        const enKeys = Object.keys(arr[0]) // [name, age, address]
        
        return arr.map(item => {
         // { name: '张三', age: 18, address: '湖北' } ==> {'姓名': '张三', '年龄': 18, '地址': '湖北'}
            const obj = {}
            enKeys.forEach(enKey => {
                const zhKey = map[enKey] // 中文的key
                obj[zhKey] = item[enKey]
            })

            return obj
        })
    }
    const arr2 = change(arr, map)
    console.log(arr2)
 // [
 // {'姓名': '张三', '年龄': 18, '地址': '湖北'},
 // {'姓名': '李四', '年龄': 18, '地址': '安徽'},
 // {'姓名': '王五', '年龄': 18, '地址': '北京'}
 // ]  
</script>